public class MyFloat {
    public static void main(String[] args){
        double d1 = 0.0 / 0;        // NaN
        double d2 = 1.0 / 0;        // Infinity
        double d3 = -1.0 / 0;       // -Infinity
        System.out.println(d1 + "  " + d2 + "   " + d3);
        MyFloat test = new MyFloat();
        test.convert();
    }

    public void convert(){
        int n1 = (int) 12.3;
        int n2 = (int) 12.8;    // 直接丢弃小数点
        int n3 = (int) (12.7 + 0.5);    // 实现四舍五入
        int n4 = (int) 1.2e20;  // 数据过大时进行强制转换，会转为为整形的最大值
        System.out.println("n1:" + n1 + " n2:" + n2 + " n3:" + n3 + " n4:" +n4);
    }
}
